package dao

import (
	"fmt"
	"new/models"
)

func GetAllphysical_exam() (error, []models.Physical_exam, int64) {
	var physical_examData []models.Physical_exam
	var total int64
	//从数据库表physical_exam中找到主码pno在对其进行操作，以下同理
	err := db.Table("physical_exam").Order("pno ASC").Count(&total).Find(&physical_examData).Error
	fmt.Println(err)
	return err, physical_examData, total
}
func Delphysical_exam(pno int) error {
	var physical_exam []models.Physical_exam
	err := db.Table("physical_exam").Where("pno = ?", pno).Delete(&physical_exam).Error
	return err
}
func Updatephysical_exam(physical_exam models.Physical_exam) error {
	err := db.Table("physical_exam").Where("reno = ?", physical_exam.Pno).Updates(&physical_exam).Error
	return err
}
func AddPhysical_exam(physical_exam models.Physical_exam) error {
	err := db.Table("physical_exam").Create(&physical_exam).Error
	return err
}
